﻿using System;
using AOT.Component;
using UnityEngine;

namespace HotUpdate.GUI
{
    public abstract class UIWindowBase : MonoBehaviour
    {
        private EWindowOpenType openType;

        public EWindowOpenType OpenType
        {
            get => openType;
            set => openType = value;
        }

        private Type windowType;

        public Type WindowType
        {
            get => windowType;
            set => windowType = value;
        }

        /// <summary>
        /// 最开始打开窗口进行的初始化
        /// </summary>
        public virtual void OnEnter()
        {
        }

        /// <summary>
        /// 窗口的每帧调用
        /// </summary>
        public virtual void OnUpdate()
        {
        }

        /// <summary>
        /// 关闭窗口的调用
        /// </summary>
        public virtual void OnClose()
        {
        }

        /// <summary>
        /// 设置窗口的可见性
        /// </summary>
        /// <param name="isVisible"></param>
        public virtual void SetVisible(bool isVisible)
        {
            gameObject.SetActive(isVisible);
        }
    }
}